package com.iscreen.utils.db.connection.mysql;

import com.iscreen.utils.constants.Constants;
import com.iscreen.utils.db.connection.DBConnectionFactory;
import com.iscreen.utils.db.connection.DBErrorHandler;

public class MySQLConnectionFactory extends DBConnectionFactory
{

	private final static String DRIVER_CLASS_NAME = "com.mysql.jdbc.Driver";
	public final static String DRIVER_NAME = "mysql";

	@Override
	protected String getConnectionUrl()
	{
		// mysql://host:port/dbName
		return DRIVER_NAME + Constants.URL_ROOT_SEPARATOR + settings.getHost()
				+ Constants.STR_COLON + settings.getPort()
				+ Constants.URL_SEPARATOR + settings.getDbName();
	}

	@Override
	protected String getDriverClassName()
	{
		return DRIVER_CLASS_NAME;
	}

	@Override
	protected DBErrorHandler getErrorHandler()
	{
		return new MySQLDBErrorHandler();
	}

}
